package com.app.shortvideo.ui.video

import android.app.Activity
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.os.Parcelable
import androidx.viewpager2.widget.ViewPager2
import com.app.shortvideo.base.BaseActivity
import com.app.shortvideo.databinding.ActivityVideoBinding
import com.app.shortvideo.ui.video.adapter.VideoListAdapter
import com.app.shortvideo.ui.viewmodel.VideoViewModel
import com.bytedance.sdk.shortplay.api.ShortPlay
import com.ss.ttvideoengine.Resolution


class VideoActivity : BaseActivity<ActivityVideoBinding, VideoViewModel>() ,VideoControlListener {
    companion object {
        fun start(context: Context,shortPlay: ShortPlay?) {
            val intent = Intent(context, VideoActivity::class.java)
            if (context !is Activity) {
                intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
            }
            intent.putExtra("currentVideo", shortPlay)
            context.startActivity(intent)
        }
    }
    override fun initData(savedInstanceState: Bundle?) {
        val parcelableShortPlay = intent.getParcelableExtra<Parcelable>("currentVideo")
        if (parcelableShortPlay == null) {
            finish()
            return
        }
        val shortPlay = parcelableShortPlay as ShortPlay
        mViewModel.initModelData(this,shortPlay)
    }

    override fun initView() {

    }

    override fun onChooseShortPlayIndex(index: Int) {
        TODO("Not yet implemented")
    }

    override fun onChooseResolution(resolution: Resolution?) {
        TODO("Not yet implemented")
    }
}
